// Copyright (c) 2002 Torvald Riegel. All rights reserved.
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.


package cpne;

import org.tigris.gef.base.*;
import org.tigris.gef.presentation.*;
import org.tigris.gef.graph.presentation.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;


public class TransitionNode extends NetNode implements Serializable 
{
    protected String id;
    protected static long idCounter = 1;
    public TransitionPort p1, p2, p3, p4;
    PerlExprDocument guardDocument;
    PerlExprDocument codeDocument;

    public void initialize(Hashtable args)
        {
            // Ports
            addPort(p1 = new TransitionPort(this));
            addPort(p2 = new TransitionPort(this));
            addPort(p3 = new TransitionPort(this));
            addPort(p4 = new TransitionPort(this));
            // ID
            id = "trans" + idCounter;
            idCounter++;
            // docs
            guardDocument = new PerlExprDocument();
            codeDocument = new PerlExprDocument();            
        }
    public Document getGuardDocument()
        {
            return guardDocument;
        }
    public Document getCodeDocument()
        {
            return codeDocument;
        }

    public String getId()
        {
            return id;
        }
    public FigNode makePresentation(Layer lay)
        {
            FigTransitionNode f = new FigTransitionNode();
            f.setOwner(this);
            return f;
        }
}
